<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="__STATIC__/web/js/rem.js"></script>
    <link rel="stylesheet" href="__STATIC__/web/css/public.css">
    <link rel="stylesheet" href="__STATIC__/web/css/result_detail.css">
    <script src="__STATIC__/web/js/jquery.js"></script>
    <title>成果详情</title>
</head>

<body>
<div class="header">
    <if condition="$uid eq null">
        <if condition="$uid eq null">
            <div class="user-login">
                <a href="{:url('login/signup')}" id="user-login">注册</a>
                <a href="{:url('login/login')}" id="user-login">登录</a>
                <a href="" id="user-logined">
                    <img src="./web/img/logined.png" />
                </a>
            </div>
            <else/>
            <div class="user-login">
                <a href="{:url('me/me')}" id="user-login">欢迎您，{$user.real_name|default='新用户'}</a>
                <a href="" id="user-logined">
                    <img src="./web/img/logined.png" />
                </a>
            </div>
        </if>
        <else/>
        <div class="login">
            <a href="{:url('me/me')}">
                <img class="login-user" src="__STATIC__/web/img/login_user.png" />
            </a>
        </div>
    </if>
    <img class="logo" src="__STATIC__/web/img/logo_white.png" />
</div>
<div class="result-detail">
    <div class="detail-title">{$fruit.title}</div>
    <div class="from-date">
        <div class="from" style="-webkit-box-orient: vertical;">发布者：{$issuer.real_name}</div>
        <div class="date">{$fruit.create_time|date="Y-m-d"}</div>
        <if condition="$collection neq null">
            <div class="collect" id="collect">
                <img id="collect-img" src="__STATIC__/web/img/collected.png">
                <div id="collect-text">已收藏</div>
            </div>
            <else/>
            <div class="collect" id="collect">
                <img id="collect-img" src="__STATIC__/web/img/collect.png">
                <div id="collect-text">点击收藏</div>
            </div>
        </if>

    </div>
    <div class="keywords">
        <div>【关键词】</div>
        <div>{$fruit.keywords}</div>
    </div>
    <if condition="$fruit.attachment neq null">
    <div class="fujian">
        <div>【附件】</div>
        <div>
            <div class="file-name">{$fruit.file_name}
                    <div class="down-file">
                            <a href="{:url('fruit/downloadFile')}?id={$fruit.id}">
                                <img src="__STATIC__/web/img/down.png">
                                <span>下载</span>
                            </a>
                        </div>
            </div>
            
        </div>
    </div>
    </if>
    <div class="neirong">
        <div>【内容】</div>
        <div>
            {$fruit.content|raw}
        </div>
    </div>
</div>
<footer>
    <div class="bottom-bar">
        <div>Copyright©2019 　山东科技大学 </div>
        <div>鲁ICP备09051012号</div>
    </div>
</footer>
<script>
    var isClick = !!`{$collection.id}` ? false : true;
    $('#collect').click(function(){
        if(isClick == true){
            isClick = false;
            $.post('collect',{type:1,cid:`{$fruit.id}`},function (res) {
                if (res.code == 0){
                    return layer.msg(res.msg)
                } else{
                    $('#collect-text').text('已收藏');
                    $('#collect-img').attr('src','__STATIC__/web/img/collected.png');
                }
            })

        }
        else if(isClick == false){
            isClick = true;
            $.post('uncollect',{type:1,cid:`{$fruit.id}`},function (res) {
                if (res.code == 0){
                    return layer.msg(res.msg)
                } else{
                    $('#collect-text').text('点击收藏');
                    $('#collect-img').attr('src','__STATIC__/web/img/collect.png');
                }
            })

        }
    })
</script>
</body>

</html>